package Gui;

import javax.swing.*;
import java.awt.*;
public class MyFrame3 extends JFrame {
    JPanel jp1,jp2,jp3;
    JLabel lable1,lable2;
    JComboBox comboBox;
    JList list;
    JScrollPane jScrollPane;


    public static void main(String[] args) {
        MyFrame3 myFrame3 = new MyFrame3();
    }

    public MyFrame3(){
        init();
        setTitle("下拉练习框");
        setBounds(600,600,600,600);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    void init(){
        setLayout(new GridLayout(3,1));
        jp1 = new JPanel();
        jp2 = new JPanel();
        jp3 = new JPanel();
        jp1.setBounds(500,500,1000,1000);
        jp2.setBounds(1000,1000,1000,1000);
        jp3.setBounds(1000,1000,1000,1000);

        lable1 = new JLabel();
        lable2 = new JLabel();

        String []str1={"北京","上海","天津","重庆","江苏",};
        comboBox = new JComboBox(str1);

        String []str2={"黄山","故宫","长城","九寨沟","天安门","湖南"};
        list = new JList(str2);
        list.setVisibleRowCount(1);
        jScrollPane = new JScrollPane(list);

        jp1.add(lable1);
        jp1.add(comboBox);

        jp2.add(lable2);
        jp2.add(jScrollPane);

        add(jp1);
        add(jp3);
        add(jp2);
    }
}
